package koction.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import koction.model.consumer.ConsumerVO;
import koction.model.productComment.ListVO;
import koction.model.productComment.ProductCommentService;
import koction.model.productComment.ProductCommentVO;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class ProductCommentController {
@Resource(name="productCommentServiceImpl")
private ProductCommentService productCommentService;

@RequestMapping("/writeProductComment.do")
@ResponseBody
public int writeProductComment(HttpSession session,ProductCommentVO pcvo){
	ConsumerVO cvo=(ConsumerVO) session.getAttribute("cvo");
	pcvo.setId(cvo.getId());
	return productCommentService.writeProductComment(pcvo);
}

@RequestMapping("/getProductCommentList.do")
@ResponseBody
public ListVO getProductCommentList(int productId,String pageNo){
	return productCommentService.getProductCommentList(productId,pageNo);
}

@RequestMapping("/writeCommentReply.do")
@ResponseBody
public int writeCommentReply(HttpSession session,int commentNo, String replyInfo){
	ConsumerVO cvo=(ConsumerVO) session.getAttribute("cvo");
	return productCommentService.writeCommentReply(cvo,commentNo,replyInfo);
}

@RequestMapping("/deleteCommentReply.do")
@ResponseBody
public int deleteCommentReply(int commentNo){
	return productCommentService.deleteCommentReply(commentNo);
}

@RequestMapping("/modifyComment.do")
@ResponseBody
public int modifyComment(int commentNo,String modifyInfo){
	return productCommentService.modifyComment(commentNo,modifyInfo);
}
}
